<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use \dmstr\bootstrap\Tabs;
use yii\helpers\StringHelper;
use chenkby\region;
/**
* @var yii\web\View $this
* @var yiike\company\model\TtycToker $model
* @var yii\widgets\ActiveForm $form
*/

?>

<div class="ttyc-toker-form">

    <?php $form = ActiveForm::begin([
    'id' => 'TtycToker',
    'layout' => 'horizontal',
    'enableClientValidation' => true,
    'errorSummaryCssClass' => 'error-summary alert alert-danger',
    'fieldConfig' => [
             'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}",
             'horizontalCssClasses' => [
                 'label' => 'col-sm-2',
                 #'offset' => 'col-sm-offset-4',
                 'wrapper' => 'col-sm-8',
                 'error' => '',
                 'hint' => '',
             ],
         ],
    ]
    );
    ?>

    <div class="">
        <?php $this->beginBlock('main'); ?>

        <p>



            <?= $form->field($model, 'id')->hiddenInput()->label() ?>
            <?php if(!$model->id){ ?>
                <?= $form->field($model, 'phone')->textInput()->label('注册手机号') ?>

                <?= $form->field($model, 'userPass')->textInput()->label('密码') ?>
            <?php  } ?>

            <!-- attribute status -->
            <?= $form->field($model, 'status')->radioList(['开启', '关闭'])->label('是否开启') ?>

            <!-- attribute mobile -->
            <?= $form->field($model, 'mobile')->textInput(['maxlength' => true]) ?>

            <!-- attribute name -->
            <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

            <!-- attribute bank_name -->
            <?= $form->field($model, 'bank_name')->textInput(['maxlength' => true]) ?>

            <!-- attribute bank_number -->
            <?= $form->field($model, 'bank_number')->textInput(['maxlength' => true]) ?>

            <!-- attribute idcard -->
            <?= $form->field($model, 'idcard')->textInput(['maxlength' => true]) ?>

            <!-- attribute bank_branch -->
            <?= $form->field($model, 'bank_branch')->textInput(['maxlength' => true]) ?>

            <!-- attribute alipay -->
            <?= $form->field($model, 'alipay')->textInput(['maxlength' => true]) ?>

            <!-- attribute weixin -->
            <?= $form->field($model, 'weixin')->textInput(['maxlength' => true]) ?>

        </p>
        <?php $this->endBlock(); ?>

        <?=
        Tabs::widget(
            [
                'encodeLabels' => false,
                'items' => [
                    [
                        'label'   => Yii::t('models', '商圈'),
                        'content' => $this->blocks['main'],
                        'active'  => true,
                    ],
                ]
            ]
        );
        ?>
        <hr/>

        <?php echo $form->errorSummary($model); ?>
        <?=
        $form->field($model, '地区')->widget(\chenkby\region\Region::className(),[
            'model'=>$model,
            'url'=> \yii\helpers\Url::toRoute(['get-region']),
            'province'=>[
                'attribute'=>'province',
                'items'=> \common\models\Region::getRegion(),
                'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择省份']
            ],
            'city'=>[
                'attribute'=>'city',
                'items'=>\common\models\Region::getRegion($model['province']),
                'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择城市']
            ],
            'district'=>[
                'attribute'=>'district',
                'items'=>\common\models\Region::getRegion($model['city']),
                'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择县/区']
            ]
        ]);
        ?>
        <?= Html::submitButton(
            '<span class="glyphicon glyphicon-check"></span> ' .
            ($model->isNewRecord ? '添加' : '保存'),
            [
                'id' => 'save-' . $model->formName(),
                'class' => 'btn btn-success'
            ]
        );
        ?>

        <?php ActiveForm::end(); ?>

    </div>

</div>

